#include "../header.h"
typedef struct review
{
    char name[32];
    int age;
}stu_t;

int main(int argc, char const *argv[])
{
    stu_t stu = {"zhangsan",18};
    FILE* fp = fopen("stu.txt","a+");
    if(fp == NULL)
    {
        perror("open error\n");
        return -1;
    }
    int len = fwrite(&stu,sizeof(stu_t),1,fp);
    printf("write %d bytes\n",len);
    //读取文件
    stu_t stu1;
    fseek(fp,0,SEEK_SET);
    fread(&stu1,sizeof(stu_t),1,fp);
    printf("name:%s age:%d\n",stu1.name,stu1.age);
    fclose(fp);
    return 0;
}
